// 实现弹框 展示用不到
$(function(){
    var $withdraw = $('#withdraw');
    $('#dialogs').on('click', '.weui-dialog__btn', function(){
        $(this).parents('.js_dialog').fadeOut(200);
    });
    $('#showWithdraw').on('click', function(){
        $withdraw.fadeIn(200);
    });
});

var rrrrrrr='500';
var hhh= ''

// 页面初始化发请求
// 获取钱包中数据的展示接口
function getMoney() {
    var newTime = timeAll();
    var timestamp = 'timeStamp:' + newTime + 'BM';
    var signs = md5(timestamp);
    signs = signs.toUpperCase();

    // 发送请求
    $.ajax({
        type: 'get',
        url: webUrl + '/mywallet/getMyWalletInfo',
        data: {
            'timeStamp': newTime,
            'sign': signs,
        },
        dataType: 'JSON',
        async: false,
        success: function (data) {
            console.log(data)
            if(data.status == 200){
                var dataMoney = data.data
                var sumMoney = dataMoney.availableAmount + dataMoney.temporaryAmount
                var sumList = '<span>当前账户总额</span>'+
                '<p>'+ sumMoney +'</p>';
                $('#sumMoney').append(sumList);

                var mayList = '<span>可提现金额</span>'+
                    '<p>'+dataMoney.availableAmount+'</p>';
                $('#mayMoney').append(mayList);

                var waitList = '<span>待入账金额</span>'+
                '<p>'+dataMoney.temporaryAmount+'</p>';
                $('#waitMoney').append(waitList)

                rrrrrrr  =  dataMoney.availableAmount;
                var waitSkipList = '<div class="wr-in col-xs-12" onclick=skipDetail(\"'+dataMoney.temporaryAmount+'\")>'+
                    '<div class="wri-l">'+
                    '<span>待入账金额明细</span>'+
                    '</div>'+
                    '<div class="wri-r">'+
                    '<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>'+
                    '</div>'+
                    '</div>';
                $('#waitSkip').append(waitSkipList);


                var maySkipList =  '<div class="mention-in col-xs-12" onclick=skipGet(\"'+dataMoney.availableAmount+'\")>'+
                    '<div class="mention-l">'+
                    '<span>可提现金额明细</span>'+
                    '</div>'+
                    '<div class="mention-r">'+
                    '<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>'+
                    '</div>';
                $('#maySkip').append(maySkipList);

            } else if (data.status == 300){
                document.location.href = '../html/login.html'
            } else {

            }
        }
    })
}



//  待提现交易明细
function skipDetail() {
    document.location.href = 'waitWithdraw.html?index='+rrrrrrr;
}
// 可以提现页面 交易明细
function skipGet() {
    document.location.href = 'withdrawDeposit.html?index='+ hhh;
}
//  预约提现页面
function skipSubscribe() {
    document.location.href = 'subscribeWithdraw.html';
}